<link href="/css/ekko-lightbox.css" rel="stylesheet">
<link href="/css/ekko-dark.css" rel="stylesheet">
<div class="col-lg-12">
	<div class="row">
		<div class="col-lg-6 col-sm-12">
			<div class="form-group">
				<label class="control-label" for="inputName">Store Name</label>
				<div class="controls">
					<input class="form-control" name="data[store_id]" type="text" disabled="true" id="inputName" value="<?php echo $distributor->title;?>" disabled="disabled">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label" for="inputDate">Date</label>
				<div class="controls">
					<input class="form-control" name="data[log_date]" type="text" disabled="true" id="inputDate" value="<?php echo date('Y-m-d');?>">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label" for="inputMethod">Contact Method</label>
				<div class="controls">
                <input class="form-control" name="data[log_date]" type="text" disabled="true" id="inputDate" 
                value="<?php  if( $contact->contact_method == 1) echo "Visited"; 
                            if( $contact->contact_method == 2) echo "Phoned";
                            if( $contact->contact_method == 3) echo "Received a call from";
                            if( $contact->contact_method == 4) echo "Cold Called";
                ?>">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label" for="inputReason">Contact Reason</label>
				<div class="controls">
					<input class="form-control" name="data[log_date]" type="text" disabled="true" id="inputDate" 
                    value="<?php if($contact->contact_reason == 1) echo "Training & Merchandising";
                                if($contact->contact_reason == 2) echo "Courtesy Call";
                                if($contact->contact_reason == 3) echo "Returning Call";
                                if($contact->contact_reason == 4) echo "Store phoned office";
                                if($contact->contact_reason == 5) echo "Merchandising";
                                if($contact->contact_reason == 6) echo "Other";
                                if($contact->contact_reason == 7) echo "Cold Call";
                                if($contact->contact_reason == 8) echo "Training";
                    
                    ?>">
				</div>
			</div>
            
            <div class="form-group">
                <label class="control-label" style="text-align: left;" for="inputComment">Contact Comment</label>
			     <p style="font-size: 16px;"><?php echo $contact->contact_comment; ?></p>
            </div>
		</div>
		<div class="col-lg-6 col-sm-12" id="outside">
			<?php if(isset($photo)) { ?>
            <?php $sql1 = "SELECT * FROM photos WHERE contact_log_id = ".$contact->id ." AND photo_type = 1";
                $result1 = Photos::model()->findBySql($sql1);  ?>
    	            <div align="center"><strong>Outside</strong></div>
                    <?php if($result1 != ''){ ?>
    	               <a class="thumbnail" href="/public/photos/<?php echo $result1->name ?>"  data-toggle="lightbox" data-gallery="multiimages" data-title="Outside">
                            <img class="img-rounded" src="/public/photos/<?php echo $result1->name ?>"/>
                        </a>
                        <?php }else{ ?>
                        <a class="thumbnail" href="/images/upload-photo.png" data-toggle="lightbox" data-gallery="multiimages" data-title="Outside">
                            <img class="img-rounded" src="/images/upload-photo.png"/>
                        </a>
                    <?php } ?>
    	        </div>
             <?php } ?>
		</div>
	</div>
	</div>
	<div id="photos" class="col-lg-12" style="margin-top: 30px;">
	    <h2>Photos (optional)</h2>
	    <div class="row">
        <?php if(isset($photo)) { ?>
                
               <?php $sql2 = "SELECT * FROM photos WHERE contact_log_id = ".$contact->id ." AND photo_type = 2";
                $result2 = Photos::model()->findBySql($sql2); ?>
	               <div id="before" style="width: 19%; float: left; margin-right: 10px;">
        	            <div align="center"><strong>Before</strong></div>
                        <?php if($result2 != ''){ ?>
        	            <a class="thumbnail" href="/public/photos/<?php echo $result2->name ?>" data-toggle="lightbox" data-gallery="multiimages" data-title="Before">
                            <img class="img-rounded" src="/public/photos/<?php echo $result2->name ?>" />
                        </a>
                        <?php }else{ ?>
                        <a class="thumbnail" href="/images/upload-photo.png" data-toggle="lightbox" data-gallery="multiimages" data-title="Before">
                            <img class="img-rounded" src="/images/upload-photo.png"/>
                        </a>
                        <?php } ?>
        	        </div>
                 
                  <?php $sql3 = "SELECT * FROM photos WHERE contact_log_id = ".$contact->id ." AND photo_type = 3";
                    $result3 = Photos::model()->findBySql($sql3); ?>
        	        <div id="after" style="width: 19%; float: left;  margin-right: 10px;">
        	            <div align="center"><strong>After</strong></div>
                        <?php if($result3 != ''){ ?>
        	               <a class="thumbnail" href="/public/photos/<?php echo $result3->name ?>" data-toggle="lightbox" data-gallery="multiimages" data-title="After">
                               <img class="img-rounded" src="/public/photos/<?php echo $result3->name ?>" />
                            </a>
                            <?php }else{ ?>
                            <a class="thumbnail" href="/images/upload-photo.png" data-toggle="lightbox" data-gallery="multiimages" data-title="After">
                                <img class="img-rounded" src="/images/upload-photo.png"/>
                            </a>
                        <?php } ?>
        	        </div>
                 
                 <?php $sql4 = "SELECT * FROM photos WHERE contact_log_id = ".$contact->id ." AND photo_type = 4";
                    $result4 = Photos::model()->findBySql($sql4); ?>
        	        <div id="display" style="width: 19%; float: left; margin-right: 10px;">
        	            <div align="center"><strong>Display 1</strong></div>
                        <?php if($result4 != ''){ ?>
            	            <a class="thumbnail" href="/public/photos/<?php echo $result4->name ?>"  data-toggle="lightbox" data-gallery="multiimages" data-title="Display">
                                <img class="img-rounded" src="/public/photos/<?php echo $result4->name ?>"/>
                            </a>
                        <?php }else{ ?>
                            <a class="thumbnail" href="/images/upload-photo.png" data-toggle="lightbox" data-gallery="multiimages" data-title="Display">
                                <img class="img-rounded" src="/images/upload-photo.png"/>
                            </a>
                        <?php } ?>
        	        </div>
               
                
                <?php $sql5 = "SELECT * FROM photos WHERE contact_log_id = ".$contact->id ." AND photo_type = 5";
                    $result5 = Photos::model()->findBySql($sql5); ?>
        	        <div id="optional" style="width: 19%; float: left;  margin-right: 10px;">
        	            <div align="center"><strong>Optional</strong></div>
                        <?php if($result5 != ''){ ?>
            	            <a class="thumbnail" href="/public/photos/<?php echo $result5->name ?>" data-toggle="lightbox" data-gallery="multiimages" data-title="Optional">
                                <img class="img-rounded" src="/public/photos/<?php echo $result5->name ?>" />
                            </a>    
                        <?php }else{ ?>
                            <a class="thumbnail" href="/images/upload-photo.png" data-toggle="lightbox" data-gallery="multiimages" data-title="Optional">
                                <img class="img-rounded" src="/images/upload-photo.png"/>
                            </a>
                        <?php } ?>
        	        </div>
                 
                 
                  <?php $sql6 = "SELECT * FROM photos WHERE contact_log_id = ".$contact->id ." AND photo_type = 6";
                    $result6 = Photos::model()->findBySql($sql6); ?>
        	        <div id="staff" style="width: 19%; float: left;">
        	            <div align="center"><strong>Staff</strong></div>
                        <?php if($result6!= ''){ ?>
            	            <a class="thumbnail" href="/public/photos/<?php echo $result6->name ?>" data-toggle="lightbox" data-gallery="multiimages" data-title="Staff">
                                <img class="img-rounded" src="/public/photos/<?php echo $result6->name ?>" />
                            </a>
                            <?php }else{ ?>
                            <a class="thumbnail" href="/images/upload-photo.png" data-toggle="lightbox" data-gallery="multiimages" data-title="Staff">
                                <img class="img-rounded" src="/images/upload-photo.png"/>
                            </a>
                        <?php } ?>
        	        </div>
            <?php } ?>
	    </div>
	</div>
    <div class="col-lg-12 text-center" style="margin-bottom: 20px;">
			<p>&nbsp;</p>
			<p><a href="/distributors/view/<?php echo $contact->distributor_id; ?>" type="submit" name="data[action]" value="save" class="btn btn-primary">Return to store profile</a></p>
	</div>
    <script src="/js/ekko-lightbox.js"></script>

<script type="text/javascript">
    $(document).ready(function ($) {
        $(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) {
            event.preventDefault();
            return $(this).ekkoLightbox();
        });
    });
</script>